import styles from './index.module.scss'

type Props = {
  closeShowList: () => void
  type: '' | 'photo' | 'gender'
  onUpdate: (key: string, value: string) => void
}

const genderList = [
  { title: '男', value: '0' },
  { title: '女', value: '1' },
]

// value值为'',将来还需要处理的,所以先为空,不需要给值
const photoList = [
  { title: '拍照', value: '' },
  { title: '本地选择', value: '' },
]

const EditList = ({ closeShowList, type, onUpdate }: Props) => {
  const list = type === 'gender' ? genderList : photoList

  return (
    <div className={styles.root}>
      {list.map((item) => (
        <div
          className="list-item"
          key={item.title}
          onClick={() => onUpdate(type, item.value)}
        >
          {item.title}
        </div>
      ))}

      <div className="list-item" onClick={closeShowList}>
        取消
      </div>
    </div>
  )
}

export default EditList
